import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
const routes = [
  {
    path: "/",
    name: "Home",
    component: HomeView,
  },
  {
    path: "/login",
    component: () => import("../views/Login.vue"),
  },
  {
    path: "/admin",
    redirect: "/admin/books-control",
    component: () => import("../views/admin/Manage.vue"),
    children: [
      {
        path: "books-control",
        component: () => import("../views/admin/BooksControl.vue"),
      },
      {
        path: "books-description-control",
        component: () => import("../views/admin/BooksDescriptionControl.vue"),
      },
      {
        path: "students-control",
        component: () => import("../views/admin/StudentsControl.vue"),
      },
      {
        path: "teachers-control",
        component: () => import("../views/admin/TeachersControl.vue"),
      },
      {
        path: "students-borrowing-control",
        component: () => import("../views/admin/StudentsBorrowingControl.vue"),
      },
      {
        path: "teachers-borrowing-control",
        component: () => import("../views/admin/TeachersBorrowingControl.vue"),
      },
      {
        path: "total",
        component: () => import("../views/admin/Total.vue"),
      },
    ],
  },
  {
    path: "/student",
    redirect: "/student/books-borrowing",
    component: () => import("../views/student/Manage.vue"),
    children: [
      {
        path: "books-borrowing",
        component: () => import("../views/student/BooksBorrowing.vue"),
      },
      {
        path: "books-borrowing-control",
        component: () => import("../views/student/BookBorrowingControl.vue"),
      },
      {
        path: "students-info",
        component: () => import("../views/student/StudentInfo.vue"),
      },
      {
        path: "students-reset-password",
        component: () => import("../views/student/ResetPassword.vue"),
      },
    ],
  },
  {
    path: "/teacher",
    redirect: "/teacher/books-borrowing",
    component: () => import("../views/teacher/Manage.vue"),
    children: [
      {
        path: "books-borrowing",
        component: () => import("../views/teacher/BooksBorrowing.vue"),
      },
      {
        path: "books-borrowing-control",
        component: () => import("../views/teacher/BookBorrowingControl.vue"),
      },
      {
        path: "teacher-info",
        component: () => import("../views/teacher/TeacherInfo.vue"),
      },
      {
        path: "teacher-reset-password",
        component: () => import("../views/teacher/ResetPassword.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes: routes,
});

export default router;
